﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Common.Model
{
    public class Room
    {
        public int roomId;
        public int type;
        public int minPlayerNumber = 2;
        public int maxPlayerNumber = 10;
        public int currentPlayerNumber = 0;

        /// <summary>
        /// 房间状态 0-未开始 1-已开始
        /// </summary>
        public int gameState = 0; 

        /// <summary>
        /// 房间玩家列表
        /// </summary>
        public List<CommonUser> playerList;
        /// <summary>
        /// 牌库
        /// </summary>
        public List<Card> cardPileList;

        public Room()
        {
            roomId = -1;
            gameState = 0;
            playerList = new List<CommonUser>();

            //Dictionary<string, object> Params = new Dictionary<string, object>()
            //        {{"content", content}, };


        }
        

        ////洗牌
        public void StartGame()
        {
            gameState = 1;
            InitCard();
        }

        //洗牌
        public void InitCard()
        {
            cardPileList = new List<Card>()
            {
                new Card(1), new Card(1), new Card(1), new Card(1), new Card(1),
                new Card(2), new Card(2),
                new Card(3) ,new Card(3),
                new Card(4), new Card(4),
                new Card(5), new Card(5),
                new Card(6),
                new Card(7),
                new Card(8),
            };
        }

        //洗牌
        public void Shuffle(int times = 100)
        {
            for (int i = 0; i < times; i++)
            {

            }
        }

        //// 摸牌 发牌
        public void Draw(int avatarIndex)
        {
            Card card = cardPileList[cardPileList.Count - 1];
            playerList[avatarIndex].handCardList.Add(card);
            cardPileList.RemoveAt(cardPileList.Count - 1);
        }

        ////出牌
        //public void Play<T>(List<T> list, int times = 100)
        //{

        //}



        //1,1,1,1,1,
        //2,2,
        //3,3,
        //4,4,
        //5,5,
        //6,
        //7,
        //8
    }
}